<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">

<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>gamvas.mouse</title><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script><script language=JavaScript src="../javascript/prettify.js"></script><script language=JavaScript src="../javascript/searchdata.js"></script></head><body class="ContentPage" onLoad="NDOnLoad();prettyPrint();"><script language=JavaScript><!--
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>

<!--  Generated by Natural Docs, version 1.51 -->
<!--  http://www.naturaldocs.org  -->

<!-- saved from url=(0026)http://www.naturaldocs.org -->




<div id=Content><div class="CClass"><div class=CTopic id=MainTopic><h1 class=CTitle><a name="gamvas.mouse"></a>gamvas.<wbr>mouse</h1><div class=CBody><h4 class=CHeading>Description</h4><p>Information and functions for the mouse.</p><h4 class=CHeading>PLEASE NOTE</h4><p>There are browsers that are not able to handle middle and right mouse buttons without problems.</p><h4 class=CHeading>Middle and rigth mouse button is successfully tested on current versions of</h4><ul><li>Chrome</li><li>Firefox</li><li>xxxterm</li></ul><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SMain"><td class=SEntry><a href="#gamvas.mouse" >gamvas.<wbr>mouse</a></td><td class=SDescription>Information and functions for the mouse.</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#gamvas.mouse.Variables" >Variables</a></td><td class=SDescription></td></tr><tr class="SVariable SIndent2 SMarked"><td class=SEntry><a href="#gamvas.mouse.LEFT" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">LEFT</a></td><td class=SDescription>Defines the left mouse button</td></tr><tr class="SVariable SIndent2"><td class=SEntry><a href="#gamvas.mouse.MIDDLE" id=link2 onMouseOver="ShowTip(event, 'tt2', 'link2')" onMouseOut="HideTip('tt2')">MIDDLE</a></td><td class=SDescription>Defines the middle mouse button</td></tr><tr class="SVariable SIndent2 SMarked"><td class=SEntry><a href="#gamvas.mouse.RIGHT" id=link3 onMouseOver="ShowTip(event, 'tt3', 'link3')" onMouseOut="HideTip('tt3')">RIGHT</a></td><td class=SDescription>Defines the right mouse button</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#gamvas.mouse.Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#gamvas.mouse.isPressed" id=link4 onMouseOver="ShowTip(event, 'tt4', 'link4')" onMouseOut="HideTip('tt4')">isPressed</a></td><td class=SDescription>Check if a mouse button is pressed</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#gamvas.mouse.getX" id=link5 onMouseOver="ShowTip(event, 'tt5', 'link5')" onMouseOut="HideTip('tt5')">getX</a></td><td class=SDescription>Returns the x position of the mouse over the canvas.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#gamvas.mouse.getY" id=link6 onMouseOver="ShowTip(event, 'tt6', 'link6')" onMouseOut="HideTip('tt6')">getY</a></td><td class=SDescription>Returns the y position of the mouse over the canvas.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#gamvas.mouse.getPosition" id=link7 onMouseOver="ShowTip(event, 'tt7', 'link7')" onMouseOut="HideTip('tt7')">getPosition</a></td><td class=SDescription>Returns the position of the mouse as gamvas.Vector2D</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#gamvas.mouse.exitEvent" id=link8 onMouseOver="ShowTip(event, 'tt8', 'link8')" onMouseOut="HideTip('tt8')">exitEvent</a></td><td class=SDescription>return from a unhandled mouseevent on onMouse* functions</td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>

<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="gamvas.mouse.Variables"></a>Variables</h3></div></div>

<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="gamvas.mouse.LEFT"></a>LEFT</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">LEFT: 0</td></tr></table></blockquote><h4 class=CHeading>Description</h4><p>Defines the left mouse button</p></div></div></div>

<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="gamvas.mouse.MIDDLE"></a>MIDDLE</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">MIDDLE: 1</td></tr></table></blockquote><h4 class=CHeading>Description</h4><p>Defines the middle mouse button</p></div></div></div>

<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="gamvas.mouse.RIGHT"></a>RIGHT</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">RIGHT: 2</td></tr></table></blockquote><h4 class=CHeading>Description</h4><p>Defines the right mouse button</p></div></div></div>

<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="gamvas.mouse.Functions"></a>Functions</h3></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gamvas.mouse.isPressed"></a>isPressed</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>isPressed: function(</td><td class="PParameter  prettyprint " nowrap>k</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><h4 class=CHeading>Description</h4><p>Check if a mouse button is pressed</p><h4 class=CHeading>Returns</h4><p>true/false</p><h4 class=CHeading>Example</h4><blockquote><pre>if (gamvas.mouse.isPressed(gamvas.mouse.LEFT)) {
    alert('you have found your left mouse button');
}</pre></blockquote></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gamvas.mouse.getX"></a>getX</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>getX: function(</td><td class="PParameter  prettyprint " nowrap>ev</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><h4 class=CHeading>Description</h4><p>Returns the x position of the mouse over the canvas.</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gamvas.mouse.getY"></a>getY</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>getY: function(</td><td class="PParameter  prettyprint " nowrap>ev</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><h4 class=CHeading>Description</h4><p>Returns the y position of the mouse over the canvas.</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gamvas.mouse.getPosition"></a>getPosition</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>getPosition: function(</td><td class="PParameter  prettyprint " nowrap>ev</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><h4 class=CHeading>Description</h4><p>Returns the position of the mouse as gamvas.Vector2D</p><h4 class=CHeading>Note</h4><p>The position is relative to the canvas, so 0/0 is the upper left corner and canvaswidth/canvasheight is the lower right corner.</p><p>To convert the canvas mouse position the the current states world use &lt;gamvas.camera.toWorld&gt; from this.camera of the current state</p><h4 class=CHeading>Returns</h4><p><a href="gamvas-vector2d-js.html#gamvas.Vector2D" class=LClass id=link9 onMouseOver="ShowTip(event, 'tt9', 'link9')" onMouseOut="HideTip('tt9')">gamvas.Vector2D</a></p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gamvas.mouse.exitEvent"></a>exitEvent</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">exitEvent: function()</td></tr></table></blockquote><h4 class=CHeading>Description</h4><p>return from a unhandled mouseevent on onMouse* functions</p><h4 class=CHeading>See</h4><p><a href="gamvas-state-state-js.html#gamvas.State.onMouseDown" class=LFunction id=link10 onMouseOver="ShowTip(event, 'tt10', 'link10')" onMouseOut="HideTip('tt10')">gamvas.State.onMouseDown</a> <a href="gamvas-state-state-js.html#gamvas.State.onMouseUp" class=LFunction id=link11 onMouseOver="ShowTip(event, 'tt11', 'link11')" onMouseOut="HideTip('tt11')">gamvas.State.onMouseUp</a> <a href="gamvas-state-state-js.html#gamvas.State.onMouseMove" class=LFunction id=link12 onMouseOver="ShowTip(event, 'tt12', 'link12')" onMouseOut="HideTip('tt12')">gamvas.State.onMouseMove</a></p></div></div></div>

</div><!--Content-->


<div id=Footer><a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->


<div id=Menu><div class=MEntry><div class=MFile><a href="gamvas-base-js.html">gamvas</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-actor-js.html">gamvas.<wbr>Actor</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-actorstate-js.html">gamvas.<wbr>ActorState</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-animation-js.html">gamvas.<wbr>Animation</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-astar-js.html">gamvas.<wbr>AStar</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-astargrid-js.html">gamvas.<wbr>AStarGrid</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-astargridnode-js.html">gamvas.<wbr>AStarGridNode</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-astarmap-js.html">gamvas.<wbr>AStarMap</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-astarnode-js.html">gamvas.<wbr>AStarNode</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-camera-js.html">gamvas.<wbr>Camera</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-class-js.html">gamvas.<wbr>Class</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-config-js.html">gamvas.<wbr>config</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-dom-js.html">gamvas.dom</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-event-js.html">gamvas.<wbr>event</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-image-js.html">gamvas.<wbr>Image</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-key-js.html">gamvas.key</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-math-js.html">gamvas.math</a></div></div><div class=MEntry><div class=MFile id=MSelected>gamvas.<wbr>mouse</div></div><div class=MEntry><div class=MFile><a href="gamvas-particleemitter-js.html">gamvas.<wbr>ParticleEmitter</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-physics-js.html">gamvas.<wbr>physics</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-physics-userdata-js.html">gamvas.<wbr>physics.<wbr>UserData</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-rect-js.html">gamvas.Rect</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-resource-js.html">gamvas.<wbr>Resource</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-screen-js.html">gamvas.<wbr>screen</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-sound-js.html">gamvas.<wbr>Sound</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-state-js.html">gamvas.<wbr>state</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-state-state-js.html">gamvas.<wbr>State</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-timer-js.html">gamvas.<wbr>timer</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-vector2d-js.html">gamvas.<wbr>Vector2D</a></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent1')">Index</a><div class=MGroupContent id=MGroupContent1><div class=MEntry><div class=MIndex><a href="../index/General.html">Everything</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Classes.html">Classes</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Functions.html">Functions</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Macros.html">Macros</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Variables.html">Variables</a></div></div></div></div></div><script type="text/javascript"><!--
var searchPanel = new SearchPanel("searchPanel", "HTML", "../search");
--></script><div id=MSearchPanel class=MSearchPanelInactive><input type=text id=MSearchField value=Search onFocus="searchPanel.OnSearchFieldFocus(true)" onBlur="searchPanel.OnSearchFieldFocus(false)" onKeyUp="searchPanel.OnSearchFieldChange()"><select id=MSearchType onFocus="searchPanel.OnSearchTypeFocus(true)" onBlur="searchPanel.OnSearchTypeFocus(false)" onChange="searchPanel.OnSearchTypeChange()"><option  id=MSearchEverything selected value="General">Everything</option><option value="Classes">Classes</option><option value="Functions">Functions</option><option value="Macros">Macros</option><option value="Variables">Variables</option></select></div><script language=JavaScript><!--
HideAllBut([], 2);// --></script></div><!--Menu-->



<!--START_ND_TOOLTIPS-->
<div class=CToolTip id="tt1"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">LEFT: 0</td></tr></table></blockquote>Defines the left mouse button</div></div><div class=CToolTip id="tt2"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">MIDDLE: 1</td></tr></table></blockquote>Defines the middle mouse button</div></div><div class=CToolTip id="tt3"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">RIGHT: 2</td></tr></table></blockquote>Defines the right mouse button</div></div><div class=CToolTip id="tt4"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>isPressed: function(</td><td class="PParameter  prettyprint " nowrap>k</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Check if a mouse button is pressed</div></div><div class=CToolTip id="tt5"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>getX: function(</td><td class="PParameter  prettyprint " nowrap>ev</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Returns the x position of the mouse over the canvas.</div></div><div class=CToolTip id="tt6"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>getY: function(</td><td class="PParameter  prettyprint " nowrap>ev</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Returns the y position of the mouse over the canvas.</div></div><div class=CToolTip id="tt7"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>getPosition: function(</td><td class="PParameter  prettyprint " nowrap>ev</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Returns the position of the mouse as gamvas.Vector2D</div></div><div class=CToolTip id="tt8"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">exitEvent: function()</td></tr></table></blockquote>return from a unhandled mouseevent on onMouse* functions</div></div><div class=CToolTip id="tt9"><div class=CClass>A 2D vector class</div></div><div class=CToolTip id="tt10"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>onMouseDown: function(</td><td class="PParameter  prettyprint " nowrap>button,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>x,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>y,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>ev</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>A mouse button was pressed</div></div><div class=CToolTip id="tt11"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>onMouseUp: function(</td><td class="PParameter  prettyprint " nowrap>button,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>x,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>y,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>ev</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>A mouse button was released</div></div><div class=CToolTip id="tt12"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>onMouseMove: function(</td><td class="PParameter  prettyprint " nowrap>x,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>y,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>ev</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>The mouse was moved</div></div><!--END_ND_TOOLTIPS-->




<div id=MSearchResultsWindow><iframe src="" frameborder=0 name=MSearchResults id=MSearchResults></iframe><a href="javascript:searchPanel.CloseResultsWindow()" id=MSearchResultsWindowClose>Close</a></div>


<script language=JavaScript><!--
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>